﻿namespace OboutInc.EasyMenu_Pro
{
    using System;
    using System.ComponentModel;
    using System.Drawing.Design;
    using System.Web.UI.Design;

    public class MenuDataItemProperties
    {
        private MenuAlign _align;
        private Corner _alignElementCorner = Corner.TopRight;
        private Corner _alignMenuCorner = Corner.TopRight;
        private int _dropdownIncrement = 10;
        private int _dropInterval = 10;
        private MenuIconsPosition _iconPosition;
        private bool _keepOpen;
        private int _offsetHorizontal;
        private int _offsetVertical;
        private MenuPosition _position = MenuPosition.Vertical;
        private int _repeatColumn = 1;
        private MenuShowEvent _showEvent;
        private string _styleFolder = string.Empty;
        private bool _useIcon;
        private string _width = "130px";
        private int _zIndex;

        public MenuAlign Align
        {
            get
            {
                return this._align;
            }
            set
            {
                this._align = value;
                switch (value)
                {
                    case MenuAlign.Above:
                        this.AlignMenuCorner = Corner.BottomLeft;
                        this.AlignElementCorner = Corner.TopLeft;
                        return;

                    case MenuAlign.Under:
                        this.AlignMenuCorner = Corner.TopLeft;
                        this.AlignElementCorner = Corner.BottomLeft;
                        return;

                    case MenuAlign.Left:
                        this.AlignMenuCorner = Corner.TopRight;
                        this.AlignElementCorner = Corner.TopLeft;
                        return;
                }
                this.AlignMenuCorner = Corner.TopLeft;
                this.AlignElementCorner = Corner.TopRight;
            }
        }

        [Description("EasyMenu's element corner to align."), Editor(typeof(UrlEditor), typeof(UITypeEditor)), Bindable(true), Category("Menu settings"), DefaultValue(1)]
        public Corner AlignElementCorner
        {
            get
            {
                return this._alignElementCorner;
            }
            set
            {
                this._alignElementCorner = value;
            }
        }

        [DefaultValue(0), Editor(typeof(UrlEditor), typeof(UITypeEditor)), Description("EasyMenu's menu corner to align."), Category("Menu settings"), Bindable(true)]
        public Corner AlignMenuCorner
        {
            get
            {
                return this._alignMenuCorner;
            }
            set
            {
                this._alignMenuCorner = value;
            }
        }

        public int DropdownIncrement
        {
            get
            {
                return this._dropdownIncrement;
            }
            set
            {
                this._dropdownIncrement = value;
            }
        }

        public int DropInterval
        {
            get
            {
                return this._dropInterval;
            }
            set
            {
                this._dropInterval = value;
            }
        }

        public MenuIconsPosition IconsPosition
        {
            get
            {
                return this._iconPosition;
            }
            set
            {
                this._iconPosition = value;
            }
        }

        public bool KeepOpen
        {
            get
            {
                return this._keepOpen;
            }
            set
            {
                this._keepOpen = value;
            }
        }

        public int OffsetHorizontal
        {
            get
            {
                return this._offsetHorizontal;
            }
            set
            {
                this._offsetHorizontal = value;
            }
        }

        public int OffsetVertical
        {
            get
            {
                return this._offsetVertical;
            }
            set
            {
                this._offsetVertical = value;
            }
        }

        public MenuPosition Position
        {
            get
            {
                return this._position;
            }
            set
            {
                this._position = value;
            }
        }

        public int RepeatColumns
        {
            get
            {
                return this._repeatColumn;
            }
            set
            {
                this._repeatColumn = value;
            }
        }

        public MenuShowEvent ShowEvent
        {
            get
            {
                return this._showEvent;
            }
            set
            {
                this._showEvent = value;
            }
        }

        public string StyleFolder
        {
            get
            {
                return this._styleFolder;
            }
            set
            {
                this._styleFolder = value.Trim();
            }
        }

        public bool UseIcons
        {
            get
            {
                return this._useIcon;
            }
            set
            {
                this._useIcon = value;
            }
        }

        public string Width
        {
            get
            {
                return this._width;
            }
            set
            {
                string str = value.Trim().ToLower();
                this._width = str + ((!str.EndsWith("px") && !str.EndsWith("%")) ? "px" : "");
            }
        }

        public int ZIndex
        {
            get
            {
                return this._zIndex;
            }
            set
            {
                this._zIndex = value;
            }
        }
    }
}

